﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CustomerPropertyList.aspx.cs" Inherits="Catering.yl.Daily.CustomerPropertyList"%>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
     <link href="../../../Style/ZHJG/zhezhao.css" rel="stylesheet" type="text/css" />
    <script src="../../../Scripts/zhezhao.js" type="text/javascript"></script>
    <script src="../../../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <script type="text/javascript">
        //显示添加
        function Add() {
            $("#txt_Company").val("");
            $("#txt_CustomerName").val("");
            $("#txt_Contacts").val("");
            $("#txt_Phone").val("");            
            $("#btnEdit").hide();
            $("#btnAdd").show();
            divshow("main", "bg");
        }
        //添加数据
        function btn_Add() {
            var txt_Company = $("#txt_Company").val();            
            if (txt_Company == "")return;            
            var txt_CustomerName = $("#txt_CustomerName").val();
            if (txt_CustomerName == "") return;
            var txt_Contacts = $("#txt_Contacts").val();
            if (txt_Contacts == "") return;
            var txt_Phone = $("#txt_Phone").val();
            if (txt_Phone == "") return;

            $.ajax({
                type: "Post",
                url: "CustomerPropertyList.aspx/Add",
                data: "{'Company':'" + txt_Company + "','CustomerName':'" + txt_CustomerName + "','Contacts':'" + txt_Contacts + "','Phone':'" + txt_Phone + "'}",                
                contentType: "application/json; charset=utf-8",
                dataType: "json",

                success: function (data) {
                    if (data.d == "OK") {
                        alert("保存成功！");
                        window.location.href = window.location.href;
                    }
                }
            });
        }
        function Edit(cid) {
            $("#HidID").val(cid);

            $.ajax({
                type: "Post",
                url: "CustomerPropertyList.aspx/Get",
                data: "{'_id':'" + cid + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    $("#txt_id").val(data.d[0] == null ? "" : data.d[0]);
                    $("#txt_Company").val(data.d[1] == null ? "" : data.d[1]);
                    $("#txt_CustomerName").val(data.d[2] == null ? "" : data.d[2]);
                    $("#txt_Contacts").val(data.d[3] == null ? "" : data.d[3]);
                    $("#txt_Phone").val(data.d[4] == null ? "" : data.d[4]);                    

                    $("#btnEdit").show();
                    $("#btnAdd").hide();
                    divshow("main", "bg");
                }
            });
        }
        //修改数据
        function btn_Edit() {
            var txt_Company = $("#txt_Company").val();
            var txt_CustomerName = $("#txt_CustomerName").val();
            var txt_Contacts = $("#txt_Contacts").val();
            var txt_Phone = $("#txt_Phone").val();            
            var cid = $("#txt_id").val();

            $.ajax({
                type: "Post",
                url: "CustomerPropertyList.aspx/Edit",
                data: "{'_id':'" + cid + "','Company':'" + txt_Company + "','CustomerName':'" + txt_CustomerName + "','Contacts':'" + txt_Contacts + "','Phone':'" + txt_Phone + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    if (data.d == "OK") {
                        alert("保存成功！");
                        window.location.href = window.location.href;
                    }
                }
            });
        } 
       
        </script>
</head>
<body>
    <form id="form1" runat="server">
       <asp:HiddenField ID="HidID" runat="server" />
      <div style="height: 36px; line-height: 40px; color:red; font-size: 13px; background-color:#0f4a98; width:998px; margin:auto"> 
            &nbsp;<%--<asp:Button ID="Button1" style="float:right; margin:8px 5px" runat="server" Text="导出Excel" />--%>&nbsp;当前位置：日报管理->设备设施->顾客财产清单
       </div>
        <div style="height: 36px; line-height: 40px; font-size: 13px; margin:auto; width:998px;background: url(../../../Images/div_h1_bg_02.gif);"> 
            <asp:Button ID="Button1" style="float:right; margin:8px 5px" runat="server" Text="导出Excel" />
            <input id="New" type="button" value="新增" style="float:right; margin:8px 5px"  onclick="Add()"/>
            按: <asp:DropDownList ID="DropDownList1" runat="server" Height="22px" Width="111px"></asp:DropDownList>    
            <asp:TextBox ID="TextBox1" runat="server" ></asp:TextBox> <asp:Button ID="Button2" runat="server"  Text="查询" />
       </div>
         <div style="padding: 0px;text-align: center;height: 29px; margin-top:10px">
            <table cellpadding="0" cellspacing="0" width="998px" style="border-left:1px solid #8b8888;border-top:1px solid #8b8888; text-align:center;margin:auto; font-size:12px;">
                    <thead>
                        <tr style="background:url(../../../Images/th_02bg.gif) repeat-x 0px 0px; height:29px;">
                            <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">序号
                            </td >
                            <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">编号
                            </td>
                            <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">提供单位
                            </td>
                            <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">顾客名称
                            </td>
                            <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">联系人(顾客)
                            </td>
                            <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">电话
                            </td>
                            <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">填表人
                            </td>                        
                            <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">填表日期
                            </td>  
                            <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">操作
                            </td>                       
                        </tr>
                    </thead>
                    <tbody>
                        <asp:Repeater ID="Rep_Plan" runat="server" OnItemCommand="Rep_Plan_ItemCommand">
                            <ItemTemplate>
                                <tr>
                                    <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">
                                        <%#Eval("tempId")%>                                    
                                    </td>
                                    <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">
                                        <%#Eval("SNumber")%>
                                    </td>
                                    <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">
                                        <%#Eval("Company")%>
                                    </td>
                                    <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">
                                        <%#Eval("CustomerName")%>
                                    </td>
                                    <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">
                                        <%#Eval("Contacts")%>
                                    </td>
                                    <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">
                                        <%#Eval("Phone")%>
                                    </td>
                                    <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">
                                        <%#Eval("LPerson")%>
                                    </td>
                                    <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">
                                        <%#Eval("SaveDate")%>
                                    </td>
                                    <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">
                                        <input id="Button0" type="button" value="提供单位" onclick="window.open('Top_Daily.aspx?mainurl=ProvideProduct.aspx&n=<%#Eval("id")%>&SNumber=<%#Eval("SNumber")%>&Company=<%#Eval("Company")%>&CustomerName=<%#Eval("CustomerName")%>&Contacts=<%#Eval("Contacts")%>&Phone=<%#Eval("Phone")%>&LPerson=<%#Eval("LPerson")%>&SaveDate=<%#Eval("SaveDate")%>', 'newwindow')"/>
                                        <img alt="" src="../../../Images/file.gif" style="cursor: pointer;" onclick="Edit('<%#Eval("id")%>')"/>                                        
                                        <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="../../../Images/trash.gif" OnClientClick="return confirm('确认删除？');"
                                        CommandArgument='<%#Eval("id")%>' CommandName="del" />
                                    </td>                                
                                </tr>
                            </ItemTemplate>
                        </asp:Repeater>
                    </tbody>
                </table>
             </div>
             <!--弹出层-->
        <div id="bg" class="bg">
        </div>
        <div id="main" class="center_div" style="width: 400px; height: 300px;margin:auto;left:35%;top:20%">
            <div class="div_0207" style="width: 398px; height: 100%;">
                <h1>
                    <img src="../../../Images/cp_h1_03.gif" />添加顾客财产清单</h1>
                <table width="100%" cellpadding="0" cellspacing="0">
                    <tr>
                        <td height="40" class="auto-style1">
                            提供单位:
                        </td>
                        <td>
                            <asp:HiddenField ID="txt_id" runat="server" />   
                            <asp:TextBox ID="txt_Company" runat="server" CssClass="input_bg" Width="100px"></asp:TextBox>                          
                        </td>
                        <td width="85" height="40" align="right">顾客名称:
                        </td>
                        <td width="65" height="40" align="right">
                            <asp:TextBox ID="txt_CustomerName" runat="server" CssClass="input_bg" Width="100px"></asp:TextBox>
                        </td>                        
                    </tr>
                    <tr>
                        <td height="40" align="right" class="auto-style1">联系人:
                        </td>
                        <td>
                            <asp:TextBox ID="txt_Contacts" runat="server" CssClass="input_bg" Width="100px"></asp:TextBox>                          
                        </td>
                        <td width="85" height="40" align="right">电话:
                        </td>
                        <td>
                            <asp:TextBox ID="txt_Phone" runat="server" CssClass="input_bg" Width="105"></asp:TextBox>                          
                        </td>               
                    </tr>                    
                </table>
                <table width="100%">
                    <tr>
                        <td height="30" align="right">
                            <input type="button" id="btnAdd" onclick="btn_Add()" class="input_btn_a" value="提交" />
                            <input type="button" id="btnEdit" onclick="btn_Edit()" class="input_btn_a" value="提交" />
                        </td>
                        <td>
                            <input type="button" id="but_Close" onclick='divhidel("main", "bg")' class="input_btn_a"
                                value="关闭" />
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </form>
</body>
</html>
